<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link href="/css/bootstrap.css" rel="stylesheet" />
    <style>
        label {
            font-weight: normal;
        }

        .panel-body .glyphicon-remove {
            display: none;
        }

        .panel-body:hover .glyphicon-remove {
            display: inline-block
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="row">
            <div class="col-xs-12 col-lg-8 col-lg-offset-2">

                <div class="row text-right">
                    <div class="col-xs-12">
                        <a href="/logout" class="btn btn-danger">退出登录</a>
                    </div>
                </div>
                
                <br>
                <div class="row">
                    <div class="col-xs-6">
                        <h2>记账本</h2>
                    </div>
                    <div class="col-xs-6 text-right">
                        <a href="/accounts/create" class="btn btn-primary">添加账单</a>
                    </div>
                </div>

                <hr />
                <div class="accounts">

                    <% accounts.forEach(item=> { %>
                        <div class="panel panel-danger">
                            <div class="panel-heading">
                                <%= moment(item.time).format('YYYY-MM-DD') %>
                            </div>
                            <div class="panel-body">
                                <div class="col-xs-6">
                                    <%= item.remarks %>
                                </div>
                                <div class="col-xs-2 text-center">

                                    <% if(item.type=='1' ){ %>
                                        <span class="label label-success">收入</span>
                                        <% }else{ %>
                                            <span class="label label-warning">支出</span>
                                            <% } %>
                                </div>
                                <div class="col-xs-2 text-right">
                                    <%= item.account %> 元
                                </div>
                                <div class="col-xs-2 text-right">
                                    <a href="/account/<%= item._id %>">
                                        <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
                                    </a>
                                </div>

                            </div>
                        </div>
                        <% }); %>

                </div>
            </div>
        </div>
    </div>
</body>

</html>